package Json2RDF.Surface2RDF.SurfaceWriter;

import RDFManager.PropertySet;
import org.apache.jena.rdf.model.Resource;

/**
 * {@code RDFTripleArrayWriter}类用于将以三坐标形式表示的数据属性写入RDF文件
 */
public class RDFTripleArrayWriter {

  /**
   * 根据数据属性名称得到对应LocalName，通过{@link PropertySet#getProperty getProperty}方法得到RDF属性对象，写入对应属性值
   *
   * @param inst         RDF实例
   * @param propertyName 数据属性名称
   * @param tripleArray  数据属性三维坐标值
   */
  public static void writeTripleArray(Resource inst, String propertyName, double[] tripleArray) {
    inst.addLiteral(PropertySet.getProperty(propertyName + "_x"), tripleArray[0]);
    inst.addLiteral(PropertySet.getProperty(propertyName + "_y"), tripleArray[1]);
    inst.addLiteral(PropertySet.getProperty(propertyName + "_z"), tripleArray[2]);
  }
}
